package com.magicsoft.share.ui.article;

import android.content.Intent;
import android.view.View;
import android.widget.ImageButton;
import android.widget.RadioButton;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.magicsoft.share.R;
import com.magicsoft.share.base.BaseActivity;
import com.magicsoft.share.base.BasePresenter;

import butterknife.BindView;
import butterknife.OnClick;

public class IsCommentActivity extends BaseActivity {


    @BindView(R.id.view_top)
    View viewTop;
    @BindView(R.id.ibtn_left)
    ImageButton ibtnLeft;
    @BindView(R.id.tv_left)
    TextView tvLeft;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.ibtn_right)
    ImageButton ibtnRight;
    @BindView(R.id.tv_right)
    TextView tvRight;
    @BindView(R.id.radio_yes)
    RadioButton radioYes;
    @BindView(R.id.layout_yes)
    RelativeLayout layoutYes;
    @BindView(R.id.radio_no)
    RadioButton radioNo;
    @BindView(R.id.layout_no)
    RelativeLayout layoutNo;
    private int iscomment = 1;
    private String commentStr = "允许";

    @Override
    public BasePresenter initPresenter() {
        return null;
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_is_comment;
    }

    @Override
    public void initData() {


    }

    @Override
    public void initView() {

        tvTitle.setText("允许评论");
    }

    @Override
    public void requestData() {

    }


    @OnClick({R.id.ibtn_left, R.id.layout_yes, R.id.layout_no})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.ibtn_left:
                Intent intent = new Intent();
                intent.putExtra("iscomment", iscomment);
                intent.putExtra("commentStr", commentStr);
                setResult(RESULT_OK, intent);
                finish();
                break;
            case R.id.layout_yes:
                iscomment = 1;
                commentStr = "允许";
                radioYes.setChecked(true);
                radioNo.setChecked(false);
                Intent intent1 = new Intent();
                intent1.putExtra("iscomment", iscomment);
                intent1.putExtra("commentStr", commentStr);
                setResult(RESULT_OK, intent1);
                finish();
                break;
            case R.id.layout_no:
                iscomment = 0;
                commentStr = "不允许";
                radioYes.setChecked(false);
                radioNo.setChecked(true);
                Intent intent2 = new Intent();
                intent2.putExtra("iscomment", iscomment);
                intent2.putExtra("commentStr", commentStr);
                setResult(RESULT_OK, intent2);
                finish();
                break;
        }
    }
}
